package database

import (
	"fmt"
	"sg-backend/global"
	"sg-backend/model/paylog"
	"sg-backend/model/user"
)

func Migrate() {

	// 从model创建数据表
	err := global.DB.AutoMigrate(
		user.User{},
		user.Menu{},
		user.Files{},
		user.Perms{},
		user.Logs{},
		user.Token{},
		paylog.PayLog{},
		paylog.IncomeLog{},
		paylog.OweLog{},
		paylog.LendLog{},
		paylog.LendPaybackLog{},
		paylog.OwePaybackLog{},
		paylog.PayType{},
		paylog.FamilyType{},
		paylog.IncomeType{},
	)
	if err != nil {
		global.SLog.Errorf("DB Migrate %v", err)
		fmt.Println("DB Migrate Error", err)
	}
}
